<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="body">
            <h:form id="SigifEventosintListForm">
                <p:breadCrumb>
                    <p:menuitem value="Home" url="#" />
                    <p:menuitem value="Consulta" url="#" />
                    <p:menuitem value="Funcionário" url="#" />
                </p:breadCrumb>   
                <p:panel>
                    <p:dataTable id="datalist"
                                 emptyMessage="Nenhum registro localizado"
                                 widgetVar="FiltroGlobal"
                                 value="#{rhTbFuncionarioController.items}" 
                                 var="item"
                                 selectionMode="single" 
                                 selection="#{rhTbFuncionarioController.selected}"
                                 paginator="true"
                                 rowKey="#{item.codFunc}"
                                 rows="10"
                                 paginatorPosition="bottom"
                                 rowsPerPageTemplate="10,20,30,40,50">

                        <f:facet name="header">
                            <p:outputPanel>
                                <p:inputText id="globalFilter" style="width:200px;" placeholder=""/>
                                <p:commandButton value="Filtrar" id="withIcon" onclick="PF('FiltroGlobal').filter()" icon="ui-icon-search" />
                                <p:commandButton id="toggler" type="button" value="Colunas" style="float:right" icon="ui-icon-calculator" rendered="false" />
                                <p:columnToggler datasource="datalist" trigger="toggler" />

                                <p:splitButton value="Exportar" icon="ui-icon-disk">
                                    <p:menuitem value="PDF"  icon="ui-icon-close"  ajax="false"><p:dataExporter type="pdf" target="datalist" fileName="Funcionarios" /></p:menuitem>
                                    <p:menuitem value="XLS"  icon="ui-icon-close"  ajax="false"><p:dataExporter type="xls" target="datalist" fileName="Funcionarios" /></p:menuitem>
                                    <p:menuitem value="CSV"  icon="ui-icon-close"  ajax="false"><p:dataExporter type="csv" target="datalist" fileName="Funcionarios" /></p:menuitem>    
                                    <p:menuitem value="XML"  icon="ui-icon-close"  ajax="false"><p:dataExporter type="xml" target="datalist" fileName="Funcionarios" /></p:menuitem>
                                </p:splitButton>
                            </p:outputPanel>
                        </f:facet> 
                        <p:column filterBy="#{item.codFunc}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListRhTbFuncionarioTitle_codFunc}"/>
                            </f:facet>
                            <h:outputText value="#{item.codFunc}"/>
                        </p:column>
                        <p:column filterBy="#{item.nomeFunc}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListRhTbFuncionarioTitle_nomeFunc}"/>
                            </f:facet>
                            <h:outputText value="#{item.nomeFunc}"/>
                        </p:column>
                        <p:column filterBy="#{item.rgNum}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListRhTbFuncionarioTitle_rgNum}"/>
                            </f:facet>
                            <h:outputText value="#{item.rgNum}"/>
                        </p:column>
                        <p:column filterBy="#{item.email}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListRhTbFuncionarioTitle_email}"/>
                            </f:facet>
                            <h:outputText value="#{item.email}"/>
                        </p:column>
                        <p:column filterBy="#{item.ativoFunc}" filterMatchMode="equals" style="width:180px;">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListRhTbFuncionarioTitle_ativoFunc}"/>
                            </f:facet>
                            <f:facet name="filter">
                                <p:selectOneButton onchange="PF('FiltroGlobal').filter()">
                                    <f:selectItem itemLabel="Todos" itemValue="" />
                                    <f:selectItem itemLabel="Sim" itemValue="S" />
                                    <f:selectItem itemLabel="Não" itemValue="N" />
                                </p:selectOneButton>
                            </f:facet>
                            <h:outputText value="#{item.ativoFunc}"/>
                        </p:column>
                        
                        <f:facet name="footer">    
                            <p:splitButton value="Exportar" icon="ui-icon-disk">
                                <p:menuitem value="PDF"  icon="ui-icon-close"  ajax="false"><p:dataExporter type="pdf" target="datalist" fileName="Funcionarios" /></p:menuitem>
                                <p:menuitem value="XLS"  icon="ui-icon-close"  ajax="false"><p:dataExporter type="xls" target="datalist" fileName="Funcionarios" /></p:menuitem>
                                <p:menuitem value="CSV"  icon="ui-icon-close"  ajax="false"><p:dataExporter type="csv" target="datalist" fileName="Funcionarios" /></p:menuitem>    
                                <p:menuitem value="XML"  icon="ui-icon-close"  ajax="false"><p:dataExporter type="xml" target="datalist" fileName="Funcionarios" /></p:menuitem>
                            </p:splitButton>
                        </f:facet>                       
                    </p:dataTable>
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
